<?php

function generarPersona () {
  return array(
    1 => (string) 28,
    2 => "Juan Perez",
    4 => "5555-5555",
    'direccion' => "desconocido",
    'telefono' => "4444-4444"
  );
}

$resultado = parse_template($template,
                            array('persona' => "generarPersona"));

?>